package fr.xgouchet.wedding.shared.model;

import fr.xgouchet.wedding.client.i18n.Messages;

/**
 * 
 * A representation of a guest within the Guest view
 * 
 * @author x.gouchet
 * 
 */
public class Guest {

	/**
	 * Default Constructor
	 */
	public Guest() {
		mID = "";
		mFirstName = "";
		mLastName = "";
		mNickname = "";
		mSex = true;
		mAge = "";
		mComingStatus = -1;
		mComingWith = "";
		mRoles = "";
		mGroup = "";
		mTable = -1;
		mSeat = -1;
	}

	/**
	 * @param iD
	 *            the iD to set
	 */
	public void setID(String iD) {
		mID = iD;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		mFirstName = firstName;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		mLastName = lastName;
	}

	/**
	 * @param nickname
	 *            the nickname to set
	 */
	public void setNickname(String nickname) {
		mNickname = nickname;
	}

	/**
	 * @param group
	 *            the side to set
	 */
	public void setGroup(String group) {
		mGroup = group;
	}

	/**
	 * @param roles
	 *            the roles to set
	 */
	public void setRoles(String roles) {
		mRoles = roles;
	}

	/**
	 * @param status
	 *            the coming to set
	 */
	public void setStatus(String status) {
		int s;

		try {
			s = Integer.valueOf(status);
		} catch (NumberFormatException e) {
			s = -1;
		}
		mComingStatus = s;
	}

	/**
	 * @param status
	 *            the coming to set
	 */
	public void setStatus(int status) {
		mComingStatus = status;
	}

	/**
	 * @param comingWith
	 *            the comingWith to set
	 */
	public void setComingWith(String comingWith) {
		mComingWith = comingWith;
	}

	/**
	 * @param age
	 *            the age to set
	 */
	public void setAge(String age) {
		mAge = age;
	}

	/**
	 * @param sex
	 *            the sex to set
	 */
	public void setSex(boolean sex) {
		mSex = sex;
	}

	/**
	 * @param table
	 *            the table where the guest is
	 * @param seat
	 *            the seat in the table
	 */
	public void setSeat(int table, int seat) {
		mTable = table;
		mSeat = seat;
	}

	/**
	 * Remove user from current seat
	 */
	public void resetSeat() {
		mTable = -1;
		mSeat = -1;
	}

	/**
	 * @return the iD
	 */
	public String getID() {
		return mID;
	}

	/**
	 * @return the firstName
	 */
	public String getFirstName() {
		return mFirstName;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return mLastName;
	}

	/**
	 * @return the nickname
	 */
	public String getNickname() {
		return mNickname;
	}

	/**
	 * @return a display name according to what is available (first, last or
	 *         nickname)
	 */
	public String getDisplayName() {
		if ((mNickname != null) && (mNickname.length() > 0))
			return Messages.I18N.displayName(mFirstName, mLastName, mNickname);
		else
			return mFirstName + " " + mLastName;
	}

	/**
	 * @return the side
	 */
	public String getGroup() {
		return mGroup;
	}

	/**
	 * @return the coming status
	 */
	public int getStatus() {
		return mComingStatus;
	}

	/**
	 * @return the comingWith
	 */
	public String getComingWith() {
		return mComingWith;
	}

	/**
	 * @return the age
	 */
	public String getAge() {
		return mAge;
	}

	/**
	 * @return the roles
	 */
	public String getRoles() {
		return mRoles;
	}

	/**
	 * @return the sex
	 */
	public boolean isMan() {
		return mSex;
	}

	/**
	 * @return the table
	 */
	public int getTable() {
		return mTable;
	}

	/**
	 * @return the seat
	 */
	public int getSeat() {
		return mSeat;
	}

	/** The id of the guest */
	private String mID;

	/** The First Name of the guest */
	private String mFirstName;

	/** The Last Name of the guest */
	private String mLastName;

	/** The NickName of the guest */
	private String mNickname;

	/** The guest's age */
	private String mAge;

	/** The sex of the guest (true = man, false = woman) */
	private boolean mSex;

	/**
	 * The specific role(s) the guest may have to play during the preparation of
	 * the wedding (eg : bridesmaid, ...) Roles are separated by a coma
	 */
	private String mRoles;

	/**
	 * The group in which the guest belongs (eg : "bride-family" or
	 * "groom-friend")
	 */
	private String mGroup;

	/**
	 * Guest status : 1 = coming, 0 = not coming, -1 = no answer yet
	 */
	private int mComingStatus;

	/**
	 * The name of the guest this one is coming with (eg: wife of a friend)
	 */
	private String mComingWith;

	/**
	 * The table at which the user is going to be during the dinner
	 */
	private int mTable;

	/**
	 * The seat in the table
	 */
	private int mSeat;
}
